<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理
        @if(View::hasSection('page_title'))
            | @yield('page_title')
        @endif
    </title>
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link href="{{ URL::asset('/static/web/css/bootstrap.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/web/font-awesome/css/font-awesome.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/lib/Hui/css/iconfont.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/web/css/animate.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/web/css/style.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/web/layui/css/layui.css')}}?v=22" rel="stylesheet">
    <link href="{{ URL::asset('/static/lib/toastr/toastr.min.css')}}" rel="stylesheet">
    <link href="{{ URL::asset('/static/web/we7/resource/css/common.css')}}" rel="stylesheet">

    <script src="{{ URL::asset('/static/web/layui/layui.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/jquery-3.1.1.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/popper.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/bootstrap.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/metisMenu/jquery.metisMenu.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/slimscroll/jquery.slimscroll.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/inspinia.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/echarts/echarts.common.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/metisMenu/jquery.metisMenu.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/echarts/theme/macarons.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/plugins/echarts/theme/westeros.js')}}"></script>
    <script src="{{ URL::asset('/static/lib/toastr/toastr.min.js')}}"></script>
    <script src="{{ URL::asset('/static/web/js/require.js')}}"></script>
</head>

<body>
@include('layouts.toastr')

@stack('scripts')

<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element col-xs-1">
                        <a class="dropdown-toggle" href="#">
                            <span class="font-bold">{{Auth::guard('admin')->user()->username}}</span>
                            <span class="float-right" id="logout" data-url="{{route('logout')}}">登出</span>
                        </a>
                    </div>
                </li>
                @foreach($leftMenuData as $key1=>$menuData)
                    <li  @if($menuData['active']) class="active" @endif>
                        <a href="{{$menuData['url']}}">
                            <i class="fa {{$menuData['ico']}}"></i>
                            <span class="nav-label">{{$menuData['name']}}</span>
                            @if(isset($menuData['child']))
                                <span class="fa arrow"></span>
                            @endif
                        </a>
                        @if(isset($menuData['child']))
                            <ul class="nav nav-second-level collapse">
                                @foreach($menuData['child'] as $key2=>$md)
                                    <li class="{{ $md['active'] ? 'active' : ''}}">
                                        <a href="{{$md['url']}}">
                                            {{$md['name']}}
                                            @if(isset($md['child']))
                                                <span class="fa arrow"></span>
                                            @endif
                                        </a>
                                        @if(isset($md['child']))
                                            <ul class="nav nav-third-level collapse" style="">
                                                @foreach($md['child'] as $key3=>$md3)
                                                    <li class="{{ $md3['active'] ? 'active' : ''}}">
                                                        <a href="{{$md3['url']}}">
                                                            {{$md3['name']}}
                                                        </a>
                                                    </li>
                                                @endforeach
                                            </ul>
                                        @endif
                                    </li>
                                @endforeach
                            </ul>
                        @endif
                    </li>
                @endforeach
            </ul>
        </div>
    </nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInRight">
            @yield('content')
        </div>
        @include('layouts.copyright')
    </div>

</div>
@yield('script')

</body>
</html>
<script>
    $(function() {
        layui.use('layer', function(){
            var layer = layui.layer;
            $('#logout').on('click', function () {
                var that = this
                layer.confirm('确认退出？', {
                    btn: ['确定','取消']
                    ,btn1: function(index, layero){
                        window.location.href = $(that).data('url')
                        layer.closeAll()
                    }
                })
            })

        });
    });
</script>
